#import "BWFabric.h"

@implementation BWFabric

+ (void) initialize
{
    [super initialize];

    NSArray *keys;
    keys = [NSArray arrayWithObjects: @"width", @"height", 
                    @"count", @"overX", nil];

    [BWFabric
        setKeys: keys
        triggerChangeNotificationsForDependentKey: @"fabricChange"];

    [BWFabric setVersion: 1];

} // initialize


// stub so that KVO will broadcast fabricChange when dependent attribute
// changes

- (BOOL) fabricChange
{
    return (YES);
} // fabricChange


- (void) setWidth: (float) w
{
    width = w;
} // setWidth


- (float) width
{
    return (width);
} // width



- (void) setHeight: (float) h
{
    height = h;
} // setHeight


- (float) height
{
    return (height);
} // height



- (void) setCount: (float) c
{
    count = c;
} // setCount


- (float) count
{
    return (count);
} // count



- (void) setOverX: (int) ox
{
    overX = ox;
} // setOverX


- (int) overX
{
    return (overX);
} // overX


- (void) encodeWithCoder: (NSCoder *) coder
{
    [coder encodeValueOfObjCType: @encode(float)
           at: &width];
    [coder encodeValueOfObjCType: @encode(float)
           at: &height];
    [coder encodeValueOfObjCType: @encode(float)
           at: &count];
    [coder encodeValueOfObjCType: @encode(int)
           at: &overX];
    
} // encodeWithCoder



- (id) initWithCoder: (NSCoder *) coder
{
    if (self = [super init]) {
        [coder decodeValueOfObjCType: @encode(float)
               at: &width];
        [coder decodeValueOfObjCType: @encode(float)
               at: &height];
        [coder decodeValueOfObjCType: @encode(float)
               at: &count];
        [coder decodeValueOfObjCType: @encode(int)
               at: &overX];
    }

    return (self);

} // coder


@end // BWFabric

